#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int demos[maxn], alive[maxn], ans = 0,count2 = 0;
bool flag = true;
void init(){
	for(int i = 1; i <= maxn; ++i)
		alive[i] = 1;
}
int main(){
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	
	int nums;
	cin >> nums;
	init();
	for(int i = 1; i <= nums; ++i)
	{
		cin >> demos[i];
		if(demos[i] == 2)
			++ count2;
		if(demos[i] > 2)
			flag = false;
	}
	if(flag)
	{
		if(2 * count2 >= nums)
			cout << count2;
		else
			cout << nums - count2;
		return 0;
	}

	sort(demos + 1, demos + nums + 1);
	/*cout << "test begin"<<endl;
	for(int i = 1; i <= nums; ++i)
		cout<<demos[i]<<" ";
	cout<< "test end";*/
	//cout << ans<<endl;
	ans = 0;
	for(int i = nums ; i >= 1; --i)	
	{	

		if(alive[i] == 1)
		{
			for(int j = 1; j < i; ++j)
			{
				if(alive[j] && demos[i] > demos[j])
				{
					alive[j] = 0;
					ans ++;
					break;
				}

			}
		}
	}
	cout<<nums - ans;
	return 0;
}